import React from 'react'
import { NavLink, useRoutes } from 'react-router-dom'
//导入路由配置文件
import routers from './routes'  //如果导入一个js结尾的文件，且文件名为index的话，可以省略不写，默认查找
export default function App() {
  //定义一个路由配置表
  let arr = useRoutes(routers);
  return (
    <div>
      <div className="row">
        <div className="col-xs-offset-2 col-xs-8">
          <div className="page-header"><h2>React Router Demo</h2></div>
        </div>
      </div>
      <div className="row">
        <div className="col-xs-2 col-xs-offset-2">
          <div className="list-group">
            <NavLink className="list-group-item" to='/about'>About</NavLink>
            <NavLink className="list-group-item" to='/home'>Home</NavLink>
          </div>
        </div>
        <div className="col-xs-6">
          {arr}
        </div>
      </div>
    </div>
  )
}
